<?php
/**
 * Author: Administrator
 * Date: 2022/7/16 2:40
 */

namespace DesignPatterns\Creation\Singleton;


class Singleton
{
    public static $count = 0;
    private static $instance;

    private function __construct()
    {
        self::$count++;
        echo 'Singleton created'.PHP_EOL;
    }


    public static function getInstance() {
        if (is_null(self::$instance)) {
            self::$instance = new static();
        }
        return self::$instance;
    }
}